#include <bits/stdc++.h>
using namespace std;

struct numble{
    int win = 0, score = 0, ball = 0;
};

int main(){
    int n;
    cin >> n;
    int m = (n * (n - 1)) / 2, o = n / 2;
    vector<string> nameteam;
    map<string, numble> teams;
    while(n--){
        string strname;
        cin >> strname;
        nameteam.push_back(strname);
    }
    cin.ignore();
    for(int i = 0; i < m; ++i) {
        string line;
        
        getline(cin, line);
        replace(line.begin(), line.end(), '-', ' ');
        replace(line.begin(), line.end(), ':', ' ');
        stringstream ss(line);
        string t1, t2;
        int score1, score2;
        ss >> t1 >> t2 >> score1 >> score2;
        if(score1 > score2){
            teams[t1].win += 3;

        }else if(score1 < score2){
            teams[t2].win += 3;
        }else{
            teams[t1].win += 1;
            teams[t2].win += 1;
        }
        teams[t1].score += (score1 - score2);
        teams[t2].score += (score2 - score1);
        teams[t1].ball += score1;
        teams[t2].ball += score2;
    }
    sort(nameteam.begin(), nameteam.end(), [&](string a, string b){
        if(teams[a].win == teams[b].win){
            return (teams[a].score == teams[b].score 
                    ? teams[a].ball > teams[b].ball 
                    : teams[a].score > teams[b].score
            );
        }
        return teams[a].win > teams[b].win;
    });
    vector<string> ans;
    for(int i = 0; i < o; ++i){
        ans.push_back(nameteam[i]);
    }
    sort(ans.begin(), ans.end());
    for(auto s : ans){
        cout << s << endl;
    }
    system("pause");
}